package com.lesson7.objectadapter;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/8/29 17:16
 */
public class VoltageAdapter implements IVoltage5V
{
    private VolTage220V v; //聚合关系

    public VoltageAdapter(VolTage220V v)
    {
        this.v = v;
    }

    @Override
    public int output5V()
    {
        int dst= 0;
        if(null!= v){
            //先获取220V的电压
            int output220V = v.output220V();
            System.out.println("使用适配器适配。。。");
            //接着进行降压操作，把220V降到5V，怎么做？除以44
            dst = output220V/44;
            System.out.println("适配成功。。。");
        }
        return dst;
    }
}
